package com.wyz.saas.common.set

import android.view.View
import androidx.annotation.NonNull
import androidx.fragment.app.Fragment
import com.atom.module.mvvm.base.AbstractFragment
import com.wyz.saas.api.common.FragmentApi

abstract class AbstractAppSetDescriptorButton : AbstractAppSetDescriptor<Any>() {

    fun loadFragment(
        @NonNull loader: Fragment,
        @NonNull fragment: Fragment,
        addToBackStack: Boolean
    ) {
        val activity = loader.activity
        if (activity is FragmentApi) {
            activity.loadFragment(fragment, addToBackStack)
        }
    }

    final override fun default(): Any {
        return Any()
    }

    final override fun get(): Any? {
        return Any()
    }


    final override fun put(t: Any) {

    }

    final override fun validate(value: Any?): Boolean {
        return true
    }

    abstract fun onClick(fragment: AbstractFragment<*,*>, view: View)

}